<?php

namespace YmPhp\Admin\Services;

use YmPhp\Admin\Models\Module;

class ModuleServices extends BasicServices
{
    public function getModules(){
        $model = (new Module())->select(['id', 'title', 'name', 'icon', 'is_commonly', 'is_wechat', 'is_tiktok', 'is_kwai', 'is_app', 'sort', 'created_at']);
        return $model->orderBy('sort')->get()->toArray();
    }


    public function getInfo($name){
        $model = (new Module())->select(['id', 'title','name', 'icon', 'is_commonly', 'is_wechat', 'is_tiktok', 'is_kwai', 'is_app', 'sort', 'created_at']);
        $model->where('is_commonly',1);
        $model->where('name',$name);
        return $model->orderBy('sort')->first();
    }

}
